package com.cl.ks.entity;


import com.alibaba.fastjson.JSONObject;
import com.cl.ks.annotation.GenerateMVC;
import com.cl.mvc.entity.BaseEntity;
import com.cl.spark.dto.SparkResult;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

@Entity
@Table(name = "spark_node")
@org.hibernate.annotations.Table(appliesTo = "spark_node", comment = "流程图节点表")
@Getter
@Setter
@ToString
@GenerateMVC
public class SparkNode extends BaseEntity implements Serializable {

    @ApiModelProperty("只读标签")
    private Boolean readOnlyFlag;
    @Transient
    private Integer positionLeft;
    @Transient
    private String code;
    @Transient
    private Integer inputNodeCount;

    @ApiModelProperty("父节点id")
    private Integer parentId;
    @ApiModelProperty("节点名称")
    private String nodeName;
    @ApiModelProperty("节点描述")
    private String nodeDescription;

    @ApiModelProperty("节点模板")
    @Column(columnDefinition = "longtext")
    private String nodeTemplate;
    @ApiModelProperty("节点路径")
    private String nodePath;
    @ApiModelProperty("图标代码")
    private String icon;
    @ManyToOne
    @ApiModelProperty("节点分类id")
    private SparkNodeCategory sparkNodeCategory;

    @Transient
    private List<SparkNode> nextSparkNodes;

    @Transient
    private Map<String, SparkResult> inputSparkResultList;

    @Transient
    private JSONObject nodeExpression;

    @ApiModelProperty("输入节点最大个数")
    private Integer inputDataListSizeMax;
    @ApiModelProperty("输入节点最小个数")
    private Integer inputDataListSizeMin;

    public SparkNode() {
    }

    public SparkNode(String code) {
        this.code = code;
    }
}
